<?php

require_once APPPATH . 'core/BaseDAO.php';

use models\M_tipo_documento;

class TipoDocumentoDAO extends BaseDAO {

    function __construct() {
        parent::__construct();
    }
	
    public function getTipoDocumento(){
		
        try {

            $query = $this->em->createQuery('SELECT t FROM models\M_tipo_documento t');

            $tipodoc = $query->getResult();

            return empty($tipodoc) ? FALSE : $tipodoc;
			
        } catch (Exception $e) {
            return FALSE;
        }
    }
    
    public function getTipoDocumentoById($idDocumento){
		
        try {

            $query = $this->em->createQuery('SELECT t FROM models\M_tipo_documento t WHERE t.id='.$idDocumento);

            $tipodoc = $query->getResult();

            return empty($tipodoc) ? FALSE : $tipodoc[0];
			
        } catch (Exception $e) {
            return FALSE;
        }
    }
		
}

?>